package com.htsk.city.services.core.dao;

import com.htsk.city.services.core.domain.Technician;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;

public interface TechnicianDao extends JpaRepository<Technician, Long>, JpaSpecificationExecutor<Technician> {
        @Query(value = "select \n" +
                "ts.technician_id technicianId, \n" +
                "sc.id serviceCategoryId, \n" +
                "sc.service_category_name serviceCategoryName, \n" +
                "s.id serviceSubCategoryId, \n" +
                "s.service_sub_category_name serviceSubCategoryName, \n" +
                "cs.service_price servicePrice \n" +
                "from\n" +
                "service_sub_category s  \n" +
                "INNER JOIN service_category sc on s.service_category_id=sc.id and s.`status`=1 and s.del_flag=0  and sc.`status`=1 and sc.del_flag=0  \n" +
                "INNER JOIN city_service_sub_category cs on s.id=cs.service_sub_category_id and cs.`status`=1\n" +
                "INNER JOIN technician_service_sub_category ts on s.id=ts.service_sub_category_id \n" +
                "where ts.technician_id= ?1 ",nativeQuery = true)
         List<Map<String,Object>> findServiceSubCategoryByTechnicianId(Long technicianId);
}
